package cn.eric.framework.exception.utils;

import cn.eric.framework.exception.domain.exception.BusinessException;

import java.util.HashMap;
import java.util.List;

public class EExceptionMap {
    private EExceptionMap() {
    }

    public static final HashMap<Integer, BusinessException> idBusinessExceptionMap = new HashMap<>();

    public static void init(List<BusinessException> businessExceptions) {
        for (BusinessException be : businessExceptions) {
            idBusinessExceptionMap.put(be.getId(), be);
        }
    }

    public static BusinessException getBEById(int id) {
        return idBusinessExceptionMap.get(id);
    }
}
